package com.xy.day4.biz;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.xy.day4.dao.AnimalMapper;
import com.xy.day4.entity.Animal;
@Service
public class AnimalBiz {
	@Resource
	private AnimalMapper dao;
	
	public void save(Animal an) {
		dao.insertSelective(an);
	}
	
	public void delete(int id) {
		dao.deleteByPrimaryKey(id);
	}
	
	public void update(Animal an) {
		dao.updateByPrimaryKeySelective(an);
	}
	
	public List<Animal> findAll() {
		
		return dao.selectAll();
	}
	
	public Animal findById(int id) {
		return dao.selectByPrimaryKey(id);
	}
}
